{temp('kefu/head')}
</head>
<body>
<nav class="breadcrumb">
	<i class="Hui-iconfont">&#xe67f;</i>首页
	<span class="c-gray en">&gt;</span>用户管理
	<span class="c-gray en">&gt;</span>个人列表
	<a class="btn btn-success radius r mr-20" style="line-height:1.6em;margin-top:3px" href="javascript:location.replace(location.href);" title="刷新" >
		<i class="Hui-iconfont">&#xe68f;</i>
	</a>
</nav>
<div style="color:red;text-align: right;">
	冻结为禁止用户登录，
	解冻为恢复用户登录权限，
	重置为将用户密码重置为“123456”。
</div>
<div class="pd-20" style="margin-top:-30px;">
	<div class="mt-20">
		<table class="table table-border table-bordered table-bg table-hover table-sort">
			<thead>
				<tr class="text-c">
					<th width="80">ID</th>
					<th>手机</th>
					<th>邮箱</th>
					<th>注册类型</th>
					<th width="120">最近一次登录时间</th>
					<th width="120">注册时间</th>
					<th>等级</th>
					<th width="320">操作</th>
				</tr>
			</thead>
			<tbody>
			{if(@$rs)}
				{foreach($rs as $k=>$v)}
				<tr class="text-c">
					<td>{$v['id']}</td>
					<td>{$v['phone']}</td>
					<td>{$v['email']}</td>
					<td>{if($v['type'] == 1)}手机{else}邮箱{/if}</td>
					<td>{code(echo date('Y-m-d H:i:s',$v['dltime']))}</td>
					<td>{code(echo date('Y-m-d H:i:s',$v['time']))}</td>
					<td>
						{if($v['level'] == 1)}带V用户（接受过线下培训）
  	   	     			{elseif($v['level'] == 2)}带W用户（由积分决定）
  	   	     			{elseif($v['level'] == 3)}带S用户（接受过线上培训）
  	   	     			{else}普通用户{/if}
  	   	     		</td>
					<td class="f-14 td-manage">
						<button style="border:0px;color:#ffffff;background-color:#68b828;padding:4px 8px;cursor:pointer;" onClick="article_edit('编辑','{$_url}/kefu/?act=user&met=gr_xiu&id={$v['id']}',{$v['id']})">编辑</button>
						{if($v['dongjie'] == 1)}
						<button style="border:0px;color:#ffffff;background-color:#cc3f44;padding:4px 8px;cursor:pointer;margin-left:10px;" onClick="dongjie({$v['id']},0)">解冻</button>
						{else}
						<button style="border:0px;color:#ffffff;background-color:#cc3f44;padding:4px 8px;cursor:pointer;margin-left:10px;" onClick="dongjie({$v['id']},1)">冻结</button>
						{/if}
						<button style="border:0px;color:#ffffff;background-color:#40bbea;padding:4px 8px;cursor:pointer;margin-left:10px;" onClick="czpass({$v['id']})">重置密码</button>
						<button style="border:0px;color:#ffffff;background-color:#f7aa47;padding:4px 8px;cursor:pointer;margin-left:10px;" onclick="czimg({$v['id']},1)">重置头像</button>
						{if($v['vlevel'] == 1)}
						<button style="border:0px;color:#ffffff;background-color:#ff6264;padding:4px 8px;cursor:pointer;margin-left:10px;" onclick="jv({$v['id']},0)">去V</button>
						{else}
						<button style="border:0px;color:#ffffff;background-color:#ff6264;padding:4px 8px;cursor:pointer;margin-left:10px;" onclick="jv({$v['id']},1)">加V</button>
						{/if}
						
					</td>
				</tr>
				{/foreach}
			{/if}
			</tbody>
		</table>
	</div>
</div>
<script type="text/javascript">
$('.table-sort').dataTable({
	"aaSorting": [[ 1, "desc" ]],//默认第几个排序
	"bStateSave": true,//状态保存
});

function jv(id,type){
	$.post('{$_url}/kefu/?act=user&met=jv',{id:id,type:type},function(data){
		if(data == 'cg'){
			if(type == 0){
				layer.alert('去V成功');				
			}else{
				layer.alert('加V成功');
			}
			setTimeout(function(){location.href = '';},800);return ;
		}else if(data == 'error'){
			if(type == 0){
				layer.alert('去V失败');return ;
			}else{
				layer.alert('加V失败');return ;
			}
		}
	});
}

function czpass(id){//重置密码
	$.post('{$_url}/admin/?act=recruit&met=user_pass{$gnpd}',{id:id},function(data){
		layer.alert(data);
		if(data == '重置成功'){
			layer.alert('重置成功');
			setTimeout(function(){location.href = '';},800);return ;
		}else{
			layer.alert(data);return ;
		}
	});
}

function czimg(id,type){//重置头像
	$.post('{$_url}/kefu/?act=user&met=czimg',{id:id,type:type},function(data){
		if(data == 'cg'){
			layer.alert('重置成功');
			setTimeout(function(){location.href = '';},800);return ;
		}else if(data == 'error'){
			layer.alert('重置失败');return ;
		}
	});
}

function dongjie(id,dongjie){//冻结
	$.post('{$_url}/admin/?act=recruit&met=user_type{$gnpd}',{id:id,dongjie:dongjie},function(data){
		if(data == 'ok'){
			layer.alert('修改成功');
			setTimeout(function(){location.href = '';},800);return ;
		}else{
			layer.alert(data);return ;
		}
	});
}

/*新闻-编辑*/
function article_edit(title,url,id,w,h){
	var index = layer.open({
		type: 2,
		title: title,
		content: url
	});
	layer.full(index);
}
</script>
{temp('kefu/foot')}
</body>
</html>